<template>
    <page-body>
        <view class="page">
            <view class="flex align-stretch benben-position-layout flex evaluate_flex_0" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
                <view class='flex align-center justify-between flex-sub evaluate_fd0_0'>
                    <view class='flex align-center evaluate_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
                        <text class='fu-iconfont2  evaluate_fd0_0_c0_c0'>&#xE794;</text>
                    </view>
                    <text class='evaluate_fd0_0_c1'>评价</text>
                    <view class='flex align-center evaluate_fd0_0_c0'>
                    </view>
                </view>

            </view>
            <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
            <!---flex布局flex布局开始-->
            <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout evaluate_flex_1">
                <view class='flex flex-wrap align-center evaluate_fd1_0' v-if="detail.send_mode == 'takeout'">
                    <image class='evaluate_fd1_0_c0' mode="aspectFill" :src='detail.rider_info.logo'></image>
                    <view class='flex flex-direction flex-wrap align-stretch flex-sub'>
                        <text class='evaluate_fd1_0_c1_c0'>{{detail.rider_info.name}}</text>
                        <text class='evaluate_fd1_0_c1_c1'>{{detail.finish_time}}左右送达</text>
                    </view>
                </view>
                <view class='flex flex-wrap align-center evaluate_fd1_1' v-if="detail.send_mode == 'takeout'">
                    <text class='evaluate_fd1_1_c0'>配送评分</text>
                    <view class='flex flex-wrap align-center' v-if="type == 1">
                        <template v-for="starNum in [1,2,3,4,5]">
                            <image v-if="detail.comment_info.rider_send_star >= starNum" :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
                            <image v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
                        </template>
                    </view>
					<view class='flex flex-wrap align-center' v-else>
					    <template v-for="starNum in [1,2,3,4,5]">
					        <image @click="input1 = starNum" v-if="input1 >= starNum" :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
					        <image @click="input1 = starNum" v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
					    </template>
					</view>
                </view>
                <view class='flex flex-wrap align-center evaluate_fd1_2'>
                    <image class='evaluate_fd1_2_c0' mode="aspectFill" :src='detail.store_info.logo'></image>
                    <text class='flex-sub evaluate_fd1_2_c1'>{{detail.store_info.name}}</text>
                </view>
                <view class='flex flex-wrap align-center evaluate_fd1_0'>
                    <text class='evaluate_fd1_1_c0'>商家评分</text>
                    <view class='flex flex-wrap align-center' v-if="type == 1">
                        <template v-for="starNum in [1,2,3,4,5]">
                            <image v-if="detail.comment_info.store_score >= starNum" :key="starNum" class='evaluate_star1fd1_3_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
                            <image v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
                        </template>
                    </view>
					<view class='flex flex-wrap align-center' v-else>
					    <template v-for="starNum in [1,2,3,4,5]">
					        <image @click="input2 = starNum" v-if="input2 >= starNum" :key="starNum" class='evaluate_star1fd1_3_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
					        <image @click="input2 = starNum" v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
					    </template>
					</view>
                </view>
                <view class='flex flex-wrap align-center evaluate_fd1_0'>
                    <text class='evaluate_fd1_1_c0'>服务态度</text>
                    <view class='flex flex-wrap align-center' v-if="type == 1">
                        <template v-for="starNum in [1,2,3,4,5]">
                            <image v-if="detail.comment_info.store_service_score >= starNum" :key="starNum" class='evaluate_star1fd1_3_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
                            <image v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
                        </template>
                    </view>
					<view class='flex flex-wrap align-center' v-else>
					    <template v-for="starNum in [1,2,3,4,5]">
					        <image @click="input3 = starNum" v-if="input3 >= starNum" :key="starNum" class='evaluate_star1fd1_3_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
					        <image @click="input3 = starNum" v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
					    </template>
					</view>
                </view>
                <view class='flex flex-wrap align-center evaluate_fd1_0'>
                    <text class='evaluate_fd1_1_c0'>菜品口味</text>
                    <view class='flex flex-wrap align-center' v-if="type == 1">
                        <template v-for="starNum in [1,2,3,4,5]">
                            <image v-if="detail.comment_info.store_dishes_score >= starNum" :key="starNum" class='evaluate_star1fd1_3_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
                            <image v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
                        </template>
                    </view>
					<view class='flex flex-wrap align-center' v-else>
					    <template v-for="starNum in [1,2,3,4,5]">
					        <image @click="input4 = starNum" v-if="input4 >= starNum" :key="starNum" class='evaluate_star1fd1_3_c1' mode="aspectFit" :src='STATIC_URL+"63.png"'></image>
					        <image @click="input4 = starNum" v-else :key="starNum" class='evaluate_star1fd1_1_c1' mode="aspectFit" :src='STATIC_URL+"62.png"'></image>
					    </template>
					</view>
                </view>
                <view class='flex flex-wrap evaluate_fd1_6' v-if="type == 1">
					<view class="evaluate_input_fd1_6" style="height: auto;">{{detail.comment_info.content}}</view>
                </view>
				<view class='flex flex-wrap evaluate_fd1_6' v-else>
				    <textarea class='flex evaluate_input_fd1_6' :placeholder="'请输入您的评价'" :adjust-position='true' :maxlength="240" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx" v-model="input5" />
				</view>
				<view class='flex flex-wrap align-center evaluate_fd1_7' v-if="type == 1 && detail.comment_info && detail.comment_info.thumb.length > 0">
				   <text class='evaluate_fd1_7_c0'>照片</text>
				</view>
				<view class='flex flex-wrap align-center' v-if="type == 1 && detail.comment_info && detail.comment_info.thumb.length > 0">
				    <template v-for='(child,key1) in detail.comment_info.thumb'>
				        <view class='flex flex-wrap align-center myReview_fd1_0_c1_c2_c0' :key='key1'>
				            <image class='myReview_fd1_0_c1_c2_c0_c0' mode="aspectFill" :src='child' @tap.stop="multiImagePreview(child,detail.comment_info.thumb,'')"></image>
				        </view>
				    </template>
				</view>
				<view class="" v-else>
					<view class='flex flex-wrap align-center evaluate_fd1_7'>
					   <text class='evaluate_fd1_7_c0'>添加照片</text>
					   <text class='evaluate_fd1_7_c1'>最多可上传9张</text>
					</view>
					<view class='flex flex-wrap align-center'>
					   <benben-images-upload ref="benbenImagesUploadfd1_8_c0" :img-list.sync="input6" :maxlength="9">
						   <template #content="{ num, maxlength, isShow, imgList }">
							   <view class="flex flex-wrap align-start flex">
								   <view v-for="(image, index) in input6" :key="index" class='flex position-relative evaluate_fd1_8_c00'>
									   <text class='fu-iconfont2 position-absolute evaluate_fd1_8_c000' @tap.stop="$refs.benbenImagesUploadfd1_8_c0.delImage(index)">&#xE8E7;</text>
									   <image class='evaluate_fd1_8_c001' @tap.stop="$refs.benbenImagesUploadfd1_8_c0.previewImage(index)" mode="aspectFill" :src='image'></image>
								   </view>
								   <image class='evaluate_fd1_8_c01' @tap.stop="$refs.benbenImagesUploadfd1_8_c0.manyChooseImage()" v-if="input6.length < 9" mode="aspectFit" :src='STATIC_URL+"34.png"'></image>
								   <text class='image_upload_tips Rzrider_fd2_0_c5_c12' style="color: rgba(0, 0, 0, 0);">最多上传{{num}}/{{maxlength}}张图片</text>
							   </view>
						   </template>
					   </benben-images-upload>
				   </view>
					<view class='flex flex-wrap align-center'>
					    <benben-flex-switch-new class-name='flex flex evaluate_fd1_9_c0' v-model="input7" :disabled='false' :auto='true'>
					        <template v-slot:checked>
					
					            <view class='flex flex position-relative align-center'>
					                <image class='evaluate_checkfd1_9_c0_c0_c0' mode="aspectFit" :src='STATIC_URL+"2.png"'></image>
					            </view>
					
					        </template>
					        <template v-slot:unchecked>
					
					            <view class='flex flex position-relative justify-end align-center'>
					                <image class='evaluate_checkfd1_9_c0_c0_c0' mode="aspectFit" :src='STATIC_URL+"3.png"'></image>
					            </view>
					
					        </template>
					    </benben-flex-switch-new>
					    <text class='evaluate_fd1_9_c1'>匿名提交</text>
					</view>
				</view>
                
                
            </view>

            <!---flex布局flex布局结束-->
            <view class="flex flex-wrap align-start justify-center benben-position-layout flex evaluate_flex_2" v-if="type != 1">
                <button class='evaluate_fd2_0' @tap.stop="getjx46b2802dc389Func()">提交</button>

            </view>
            <view :style="{height: '120rpx'}"></view>


        </view>
    </page-body>
</template>
<script>
    import {
        validate
    } from '@/common/utils/validate.js'

    export default {
        components: {},


        data() {
            return {
                "detail": {
                    "aid": "",
                    "order_sn": "",
                    "status": "",
                    "user_nickname": "",
                    "user_mobile": "",
                    "send_mode": "",
                    "is_at_once": "",
                    "expected_time": "",
                    "pick_mobile": "",
                    "pick_code": "",
                    "pick_time": "",
                    "remark": "",
                    "create_time": "",
                    "order_money": "",
                    "real_money": "",
                    "userstore_id": "",
                    "rider_id": "",
                    "pack_money": "",
                    "freigh": "",
                    "store_info": {
                        "aid": "",
                        "name": "",
                        "logo": "",
                        "address": "",
                        "tel": "",
                        "address_province": "",
                        "address_city": "",
                        "address_district": "",
                        "address_lng": "",
                        "address_lat": ""
                    },
                    "goods_list": [],
                    "refund_info": {
                        "status": ""
                    },
                    "pay_time": "",
                    "store_address": "",
                    "user_address": "",
                    "store_mobile": "",
                    "pay_type": "",
                    "rider_info": {
                        "aid": "",
                        "name": "",
                        "phone": "",
                        "logo": "",
                        "address_lng": "",
                        "address_lat": "",
                        "score": "",
                        "order_num": ""
                    },
                    "num": "",
                    "pick_mobile_ps": "",
                    "platform_profits": "",
                    "income": "",
                    "store_profits": "",
                    "store_code": "",
                    "finish_time": "",
                    "cancel_type": "",
                    "coupon_money": "",
                    "activity_money": "",
                    "payable_money": "",
                    "pay_time_end": "",
                    "address": {
                        "order_sn": "",
                        "address_id": "",
                        "receiver_mobile": "",
                        "receiver_address": "",
                        "receiver_name": "",
                        "receiver_lng": "",
                        "receiver_lat": "",
                        "province": "",
                        "city": "",
                        "district": ""
                    },
                    "progress_state": "",
                    "order_goods_info": {
                        "order_sn": "",
                        "address_id": "",
                        "receiver_mobile": "",
                        "receiver_address": "",
                        "receiver_name": "",
                        "receiver_lng": "",
                        "receiver_lat": "",
                        "province": "",
                        "city": "",
                        "district": "",
                        "sex": ""
                    }
                },
                "input1": 5,
                "input2": 5,
                "input3": 5,
                "input4": 5,
                "input5": "",
                "input6": [],
                "input7": false,
                "aid": "",
				postTtype:false,
				type:'',
            };
        },
        computed: {

        },
        watch: {},
        onLoad(options) {
            let {
                aid,type
            } = options
            if (aid !== undefined) this.aid = aid
            if (type !== undefined) this.type = type
            this.getsa46b2e719a5caFunc()
        },
        onUnload() {

        },
        onReady() {

        },
        onShow() {

        },
        onHide() {

        },
        onResize() {

        },
        onPullDownRefresh() {

        },
        onReachBottom(e) {

        },
        onPageScroll(e) {

        },
        methods: {
            //用户端=>订单详情
            async getsa46b2e719a5caFunc() {
                //请求方法
                //数据验证

                let datadetail = await this.$api.get(global.apiUrls.post646b2e719a5ca, {
                    aid: this.aid
                });

                if (datadetail.data.code != 1) {
                    this.$message.info(datadetail.data.msg);
                    return
                }
                let infodetail = datadetail.data;
                this.detail = infodetail.data

            },
            //评价
            async getjx46b2802dc389Func() {
                if (!validate(this.input5, 'require')) {
                    this.$message.info('请填写评价内容');
                    return false;
                }
                //请求方法
                //数据验证
				if(this.postTtype){
					return
				}
				this.postTtype = true
                let data646b2802dc389 = await this.$api.post(global.apiUrls.post646b2802dc389, {
                    store_score: this.input2,
                    store_service_score: this.input3,
                    store_dishes_score: this.input4,
                    rider_send_star: this.input1,
                    content: this.input5,
                    thumb: this.input6.toString(),
                    is_anony: this.input7 ? 1 : '0',
                    orderinfo_id: this.aid
                });

                if (data646b2802dc389.data.code != 1) {
                    this.$message.info(data646b2802dc389.data.msg);
					this.postTtype = false
                    return
                }
                let info646b2802dc389 = data646b2802dc389.data;


                uni.showToast({
                    title: '评价成功',
                    mask: true,
                    icon: 'none',
                    duration: 1500
                });
                setTimeout(() => {
                    this.$urouter.navigateBack(1);
                }, 500)
            }
        }
    };
</script>
<style lang="scss" scoped>
    .page {
        width: 100vw;
        overflow-x: hidden;
        min-height: calc(100vh - var(--window-bottom));
        background: #fff;
        background-size: 100% auto;
    }

    .evaluate_flex_0 {
        background: #fff;
        width: 750rpx;
        height: 88rpx;
        overflow: hidden;
        z-index: 10;
        top: 0rpx;
        background-size: 100% auto !important;
    }

    .evaluate_fd0_0_c1 {
        font-size: 36rpx;
        font-weight: 500;
        color: var(--benbenFontColor0);
    }

    .evaluate_fd0_0_c0_c0 {
        font-size: 32rpx;
        font-weight: 500;
        color: #333;
    }

    .evaluate_fd0_0_c0 {
        width: 180rpx;
        height: 88rpx;
    }

    .evaluate_fd0_0 {
        padding: 0rpx 32rpx 0rpx 32rpx;
        height: 88rpx;
    }

    .evaluate_flex_1 {
        padding: 32rpx 32rpx 0rpx 32rpx;
    }

    .evaluate_fd1_9_c1 {
        color: #333333;
        font-size: 24rpx;
        font-weight: 400;
        line-height: 33rpx;
        text-align: left;
        font-style: normal;
    }

    .evaluate_checkfd1_9_c0_c0_c0 {
        width: 28rpx;
        height: 28rpx;
    }

    ::v-deep .evaluate_fd1_9_c0 {
        margin: 0rpx 16rpx 0rpx 0rpx;
    }

    .evaluate_fd1_8_c01 {
        width: 180rpx;
        height: 180rpx;
        margin: 0rpx 20rpx 24rpx 0rpx;
        border-radius: 16rpx;
    }

    .evaluate_fd1_8_c001 {
        width: 180rpx;
        height: 180rpx;
        border-radius: 16rpx;
    }

    .evaluate_fd1_8_c000 {
        top: 0rpx;
        right: 0rpx;
        z-index: 10;
        color: #ff5536;
    }

    .evaluate_fd1_8_c00 {
        margin: 0rpx 20rpx 24rpx 0rpx;
    }

    .evaluate_fd1_7_c1 {
        color: #BFBFBF;
        font-size: 20rpx;
        font-weight: 400;
        line-height: 28rpx;
        margin: 0rpx 0rpx 0rpx 8rpx;
    }

    .evaluate_fd1_7_c0 {
        color: #333333;
        font-size: 28rpx;
        font-weight: 500;
        line-height: 40rpx;
    }

    .evaluate_fd1_7 {
        margin: 32rpx 0rpx 24rpx 0rpx;
    }

    .evaluate_input_fd1_6 {
        width: 100%;
        height: 140rpx;
        font-size: 28rpx;
        font-weight: 400;
        color: #333;
        white-space: pre-wrap;
    }

    .evaluate_fd1_6 {
        background: rgba(246, 247, 249, 1);
        padding: 24rpx 24rpx 24rpx 24rpx;
        border-radius: 16rpx;
    }

    .evaluate_star1fd1_3_c1 {
        width: 32rpx;
        height: 32rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
        margin: 0rpx 10rpx 0rpx 0rpx;
    }

    .evaluate_fd1_2_c1 {
        color: #333333;
        font-size: 32rpx;
        font-weight: 600;
        line-height: 45rpx;
        text-align: left;
        font-style: normal;
        -webkit-line-clamp: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
    }

    .evaluate_fd1_2_c0 {
        width: 80rpx;
        height: 80rpx;
        border-radius: 16rpx;
        margin: 0rpx 24rpx 0rpx 0rpx;
    }

    .evaluate_fd1_2 {
        margin: 0rpx 0rpx 40rpx 0rpx;
    }

    .evaluate_star1fd1_1_c1 {
        height: 32rpx;
        margin: 0rpx 10rpx 0rpx 0rpx;
        width: 32rpx;
    }

    .evaluate_star1fd1_1_c1 {
        width: 32rpx;
        height: 32rpx;
        border-radius: 0rpx 0rpx 0rpx 0rpx;
        margin: 0rpx 10rpx 0rpx 0rpx;
    }

    .evaluate_fd1_1_c0 {
        margin: 0rpx 32rpx 0rpx 0rpx;
        color: #333333;
        font-size: 28rpx;
        font-weight: 500;
        line-height: 40rpx;
    }

    .evaluate_fd1_1 {
        margin: 0rpx 0rpx 56rpx 0rpx;
    }

    .evaluate_fd1_0_c1_c1 {
        color: #999999;
        font-size: 24rpx;
        font-weight: 400;
        line-height: 33rpx;
        text-align: left;
        font-style: normal;
    }

    .evaluate_fd1_0_c1_c0 {
        color: #333333;
        font-size: 32rpx;
        font-weight: 600;
        line-height: 45rpx;
        margin: 0rpx 0rpx 8rpx 0rpx;
    }

    .evaluate_fd1_0_c0 {
        width: 80rpx;
        height: 80rpx;
        border-radius: 80rpx;
        margin: 0rpx 24rpx 0rpx 0rpx;
    }

    .evaluate_fd1_0 {
        margin: 0rpx 0rpx 32rpx 0rpx;
    }

    .evaluate_flex_2 {
        width: 750rpx;
        height: 120rpx;
        overflow: hidden;
        z-index: 10;
        bottom: calc(0rpx + var(--window-bottom));
    }

    .evaluate_fd2_0 {
        background: var(--benbenbgColor0);
        border-radius: 40rpx 40rpx 40rpx 40rpx;
        width: 654rpx;
        line-height: 80rpx;
        font-size: 28rpx;
        color: #fff;
        height: 80rpx;
    }
	.myReview_fd1_0_c1_c2_c0_c0 {
	    width: 196rpx;
	    height: 196rpx;
	    border-radius: 8rpx;
	}
	
	.myReview_fd1_0_c1_c2_c0 {
	    margin: 0rpx 2rpx 24rpx 2rpx;
	}
</style>